function RBCFeed(baseURL, newContext) {
	var self = this;
	name = null;
	userid = null;
	firebase = null;
	mainUser = null;
	fullName = null;

	// Every time we call _firebaseRef.on, we need to remember to call .off,
	// when requested by the caller via unload(). We'll store our handlers
	// here so we can clear them later.
	handlers = [];

	firebase = new Firebase(baseURL);

	authHandlers = [];
	firebaseAuthClient = new FirebaseSimpleLogin(firebase, function(error, user) {
		onLoginStateChange(error, user);
	});
}

RBCFeed.prototype.onLoginStateChange = function(error, user) {
		
		if (error) {
			alert(error);
			console.log(error);
			// An error occurred while authenticating the user.
		} else if (user) {
			// The user is successfully logged in.
			console.log('Logged In');
		} else {
			// No existing session found - the user is logged out.
			console.log('Logged Out');
		}
	};
	

RBCFeed.prototype.createAccount = function(provider, username, password, firstname, lastname, bio, location) {
	var newData = firebase;
	
	firebaseAuthClient.createUser(username, password, function(error, user) {
		if (!error) {
			console.log('User Id: ' + user.uid + ', Email: ' + user.email);
			console.log(firstname + lastname + bio + location);

			var onComplete = function(error) {
				if (error)
					alert('Synchronization failed.');
				else
					alert('Synchronization succeeded.');
			};
			newData.child('people').child(user.id).set({
				fullName : firstname + lastname,
				name : firstname,
				bio : bio,
				location : location
			}, onComplete);

		} else {
			alert(error);
		}
	});
};

RBCFeed.prototype.login = function(provider, username, password) {
	firebaseAuthClient.login('password', {
		email : username,
		password : password
	});
};
